# locust777

//---------------------------------------------------------------------------------------------------------------------------------

//5. 一些调试的实例

#include<stdio.h>
#include<windows.h>
int main()
{
	//1+2+6 = 9
	int n = 3;
	//scanf("%d",&n);
	int i = 0;
	int ret = 1;
	int sum = 0;
	int j = 0;

	for(j = 1;j <= n;j++)
	{
		for(i = 1;j <= n;j++)
		{
			ret *=i;  //1*1*2*3*4……n
		}
		sum += ret; //6+2+1
	}
	printf("%d\n",sum);


system("pause");
return 0;
}


int main()
{
	int i = 0;
	int arr[10] = {1,2,3,4,5,6,7,8,9,10};
	//0-9

	for(i = 0;i <= 12;i++)
	{
		arr[i] = 0;
		printf("hehe\n");
	
	}

return 0;
}






#include<string.h>

int mian()
{
	char arr1[20] = { 0 };
	char arr2[] = "hello bit";
	//strcpy在拷贝字符串的时候，会把源字符串中的\0也拷贝过去
	strcpy(arr1,arr2);

	printf("%s\n",arr1);


return 0;
}




void my_strcpy(char* dest,char* src)
{
	while(*src != '\0')
	{
	*dest = *src;                      //5分的代码
	dest++;
	src++;
	}
	*dest = *src;

}
int main()
{

	char arr1[20] = "xxxxxxxxxxxxxx";
	char arr2[] = "hello bit";
	//strcpy在拷贝字符串的时候，会把源字符串中的\0也拷贝过去
	my_strcpy(arr1,arr2);

	printf("%s\n",arr1);

return 0;
}





#include<string.h>
#include<stdio.h>
#include<windows.h>
void my_strcpy(char* dest,const char* src)
{
	//断言
	assert(src != NULL); // ?
	assert(dest != NULL);

	while(*dest++ = *src++)
	{
		;
	}
}
int main()
{

	char arr1[20] = "xxxxxxxxxxxxxx";
	char arr2[] = "hello bit";
	//strcpy在拷贝字符串的时候，会把源字符串中的\0也拷贝过去
	my_strcpy(arr1,arr2);

	printf("%s\n",arr1);

return 0;
}




int main()
{
	//int num = 0;
	//num = 20;
	//printf("%d\n",num);

	const int num = 0;
	//num = 20;

	printf("%d\n",num);


return 0;
}



int main()
{
	//int num = 0;
	//num = 20;
	//printf("%d\n",num);

	const int num = 0;
	//num = 20;
	int*p = &num;
	*p = 20;

	printf("%d\n",num);


return 0;
}


int main()
{
	//int num = 0;
	//num = 20;
	//printf("%d\n",num);

	const int num = 0;
	//num = 20;
	const int* p = &num;
	*p = 20;

	printf("%d\n",num);


return 0;
}
